package List;

import java.util.Iterator;
import java.util.LinkedList;

public class LinkedListDemo {
    public static void main(String[] args) {
        LinkedList list = new LinkedList();
        list.addFirst("123");
        list.addFirst("456");
        list.addFirst("789");
        System.out.println(list);
        for (Iterator it = list.iterator(); it.hasNext();) {
            System.out.println(it.next());
        }
        System.out.println("获取数组中的第一个元素" + list.getFirst());
        System.out.println("获取数组中的最后一个元素" + list.getLast());
    }
}
